#include <stdio.h>
#include <math.h>

//筛出n所有可能的质因子
int * primeSieve(int n,int &len)
{
    int max=(int)sqrt(n);
    int* array=new int[max];
    array[0]=2;
    len=1;
    for(int i=3;i<=max;i++)
    {
        int flag=0;
        for(int j=0;j<len;j++)
        {
            if(i%array[j]==0)
            {
                flag=1;
                break;
            }
        }
        if(!flag)
        {
            array[len]=i;
            len++;
        }
    }


    return array;
}

//因式分解
int * factorization(int n,int *prime,int len)
{
    int* array=new int[len];
    int i,tmp=n;
    for(i=0;i<len;i++)
    {
        array[i]=0;
    }
    while (tmp>1)
    {
        for(i=0;i<len;i++)
        {
            if(tmp%prime[i]==0)
            {
                array[i]++;
                tmp=tmp/prime[i];
                break;
            }
        }
    }
    return array;
}

int main(){
    int i,j,n,m1,m2;
    scanf("%d",&n);
    scanf("%d %d",&m1,&m2);
    int* cell=new int[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&cell[i]);
    }

    int len=0;
    int* prime=primeSieve(n,len);
    int* fac_m1=factorization(m1,prime,len);
    int* fac_m2=factorization(m2,prime,len);

    for(i=0;i<n;i++)
    {
        int* fac_tmp=factorization(cell[i],prime,len);

        delete fac_tmp;
    }

    delete cell;
    delete prime;
    delete fac_m1;
    delete fac_m2;

    return 0;
}